package com.app.db.mongodb;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.index.TextIndexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Date;

@Getter
@Setter
@Document(collection = "dev_user_liuli")
//复核索引
// @CompoundIndex(name = "id_date", def = "{'id': 1, 'makeDate': 1}")
public class MongoUserEntity {
    /**添加索引  如果unique = true  @Field不能是_id */
    @Indexed(unique = true )
    @Field("id")
    Long id;
    @TextIndexed
    String title;
    @TextIndexed
    String msg;
    /**30秒后删除该条数据 时间一旦设定不能更改 */
   // @Indexed(expireAfterSeconds = 30)
    Date makeDate;
    Double money;
}
